const chunkArrayInGroups = (arr, num) => {
  const len = Math.ceil(arr.length / num);
  const arr2D = [];
  for (let i=0, j=0; i<len; i++, j+=num) {
    arr2D.push(arr.slice(j, j+num));
  }
  return arr2D;
}


console.log(chunkArrayInGroups(["a", "b", "c", "d"], 2));
console.log(chunkArrayInGroups([0, 1, 2, 3, 4, 5], 4));